home *** CD-ROM | disk | FTP | other *** search
/ Champak 26 (Anniversary Edition) / Volume 26 [Anniversary Edition] - JOGO DISK .iso / DEPOSITO / REmovido / Esportes / LightningBreak.swf / scripts / frame_1 / DoAction_5.as < prev    next >
Text File  |  2006-06-13  |  3KB  |  73 lines

  1. CLevel = function(xml)
  2. {
  3.    this.level = xml;
  4.    this.needScore = 10;
  5.    this.draw();
  6. };
  7. CLevel.prototype.draw = function()
  8. {
  9. };
  10. CLevel.prototype.serialize = function()
  11. {
  12.    var i = 0;
  13.    while(i < _root.ballsAmount)
  14.    {
  15.       var obj = _root.balls[i];
  16.       var ball = this.level.firstChild.childNodes[i];
  17.       ball.attributes.id = obj.id;
  18.       ball.attributes.x = obj.x;
  19.       ball.attributes.y = obj.y;
  20.       i++;
  21.    }
  22.    return this.level;
  23. };
  24. CLevel.prototype.init = function()
  25. {
  26.    var level = this.level.firstChild;
  27.    this.title = "Level " + _root.actLevel + ": " + unescape(level.attributes.title) + " " + (_root.superLevel <= 1 ? "" : _root.superLevel + 1);
  28.    this.description = unescape(level.attributes.desc);
  29.    this.needPottedRed = int(level.attributes.needred);
  30.    this.needPottedColor = int(level.attributes.needcolor);
  31.    this.needBreak = int(level.attributes.needbreak);
  32.    this.needExact = int(level.attributes.needexact);
  33.    this.needOrder = level.attributes.needorder;
  34.    this.dontRespotColors = int(level.attributes.dontRespotColors);
  35.    this.time = int(level.attributes.time);
  36.    this.frame = int(level.attributes.frame);
  37.    this.speedUp = level.attributes.speedup ne "" ? int(level.attributes.speedup) : 1;
  38.    _root.timer.speed = level.attributes.timespeed ne "" ? Number(level.attributes.timespeed) : 1;
  39.    this.skin = level.attributes.skin ne "" ? level.attributes.skin : "default";
  40.    this.colorSwap = int(level.attributes.colorswap);
  41.    _root.swapTimerThreashold = this.colorSwap != 1 ? (this.colorSwap != 2 ? 90 : 90) : 180;
  42.    this.friction = level.attributes.friction ne "" ? Number(level.attributes.friction) : _root.table.friction;
  43.    this.breakout = level.attributes.breakout ne "" ? 1 : 0;
  44.    var i = 0;
  45.    while(i < 6)
  46.    {
  47.       this["h" + i] = level.attributes["l" + i];
  48.       _root.lids[i].gotoAndStop(int(level.attributes["l" + i]) + 1);
  49.       i++;
  50.    }
  51.    var i = 0;
  52.    while(i < _root.ballsAmount)
  53.    {
  54.       var ball = _root.balls[i];
  55.       ball.x = _root.lvlProto[i].x + (Math.random() - 0.5) * _root.spotVariance;
  56.       ball.y = _root.lvlProto[i].y + (Math.random() - 0.5) * _root.spotVariance;
  57.       ball.reset();
  58.       i++;
  59.    }
  60.    for(var item in level.childNodes)
  61.    {
  62.       item = this.level.firstChild.childNodes[item];
  63.       if(item.nodeName === "b")
  64.       {
  65.          var ball = _root.balls[item.attributes.id];
  66.          ball.x = Number(item.attributes.x) + (Math.random() - 0.5) * _root.spotVariance;
  67.          ball.y = Number(item.attributes.y) + (Math.random() - 0.5) * _root.spotVariance;
  68.          ball.reset();
  69.       }
  70.    }
  71.    _root.cue._alpha = 0;
  72. };
  73.